package com.smart.service.impl;

import com.smart.dto.SysCarDto;
import com.smart.entity.SysCar;
import com.smart.service.sys.SysCarService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
 * @author lgb
 * @date 2020年6月17日 上午8:20:10
 * Copyright (C) 深圳工勘科技
 * @说明: 车辆serviceimpl
 **/
@Service
public class SysCarServiceImpl extends BaseServiceImpl<SysCar,Integer>
      implements SysCarService{

	/** 
	 * (non-Javadoc)
	 * @see: 获取分页数据
	 **/
	@Override
	@Transactional(readOnly=true)
	public IPage<SysCar> findPage(SysCarDto carDto,Integer pageSize,Integer pageNum){
		LambdaQueryWrapper<SysCar> wrapper = new LambdaQueryWrapper<>();
		if(StringUtils.isNotEmpty(carDto.getCarNo())){
			wrapper.eq(SysCar::getCarNo,carDto.getCarNo());
		}
		if(StringUtils.isNotEmpty(carDto.getCreateDate_s())){
			wrapper.gt(SysCar::getCreateTime,carDto.getCreateDate_s());
		}
		if(StringUtils.isNotEmpty(carDto.getCreateDate_e())){
			wrapper.lt(SysCar::getCreateTime,carDto.getCreateDate_e());
		}
		return page(new Page<>(pageNum,pageSize),wrapper);
	}

	
}